#ifndef __RENDERSTATE_MCR__
#define __RENDERSTATE_MCR__

#define declare_default_state(classname) \
	public: \
		static classname* get_default() { return m_sdefault; } \
	protected: \
		static classname##Ptr m_sdefault; \
		friend class _##classname##InitTermDS
#define ImplementDefaultState(classname) \
	classname##Ptr classname::m_sdefault = 0; \
	class _##classname##InitTermDS \
	{ \
	public: \
		_##classname##InitTermDS() \
		{ \
			classname::m_sdefault = new classname; \
			RenderState::Type etype = \
				classname::m_sdefault->get_type(); \
			classname::m_sdefault[etype] = classname::m_sdefault; \
		} \
		~_##classname##InitTermDS()
		{ \
			classname::m_sdefault = 0; \
		} \
	}; \
	
	static _##classname##InitTermDS _force##classname##InitTermDS

#define RenderStateCast( classname, state ) \
	(classname*)(RenderState*) state;

#endif 
	
		